﻿using System;

namespace PropertyExpression.TypedSqlBuilder.Test
{
    public partial class SqlTest
    {
        private static ISelect<SalesOrderHeaderProjection> SelectSalesOrderHeaderProjection(
            IValue<DateTime> orderDate)
        {
            return Schema.SelectSalesOrderHeaderProjection(orderDate);
        }

        private static ISelect<SalesOrderHeaderOuterProjection> SelectSalesOrderHeaderOuterProjection(
            IValue<DateTime?> orderDate)
        {
            return Schema.SelectSalesOrderHeaderOuterProjection(orderDate);
        }

        private static IWhere Where(IValue<bool> value)
        {
            return Query.Where(value);
        }

        private static ISelect<TEntity> Select<TEntity>()
        {
            return Query.Select<TEntity>();
        }

        private static ITable<SpecialOfferProduct> SpecialOffers
        {
            get { return Schema.SpecialOfferProducts; }
        }

        private static ITable<SpecialOfferProduct> SpecialOfferProducts
        {
            get { return Schema.SpecialOfferProducts; }
        }

        private static ITable<SalesOrderDetail> SalesOrderDetails
        {
            get { return Schema.SalesOrderDetails; }
        }

        private static ITable<SalesOrderHeader> SalesOrderHeaders
        {
            get { return Schema.SalesOrderHeaders; }
        }

        private static ITable<Product> Products
        {
            get { return Schema.Products; }
        }

        private static ITable<Individual> Individuals
        {
            get { return Schema.Individuals; }
        }

        private static ITable<Contact> Contacts
        {
            get { return Schema.Contacts; }
        }

        private static ITuple<T1, T2, T3> To<T1, T2, T3>(T1 item1, T2 item2, T3 item3)
        {
            return Query.To(item1, item2, item3);
        }

        private static ITuple<T1, T2> To<T1, T2>(T1 item1, T2 item2)
        {
            return Query.To(item1, item2);
        }

        private static IFrom<TSelectEntity> From<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<IRow<TEntity>, IJoin<TSelectEntity>> innerJoin)
        {
            return table.From(innerJoin);
        }

        private static IInnerJoin<TSelectEntity> InnerJoin<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<IRow<TEntity>, ITuple<IValue<bool>, IJoin<TSelectEntity>>> tuple)
        {
            return table.InnerJoin(tuple);
        }

        private static IInnerJoin<TSelectEntity> InnerJoin<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<IRow<TEntity>, ITuple<IValue<bool>, IWhere, ISelect<TSelectEntity>>> func)
        {
            return table.InnerJoin(func);
        }

        public static ILeftOuterJoin<TSelectEntity> LeftOuterJoin<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<INullableRow<TEntity>, ITuple<IValue<bool>, IWhere, ISelect<TSelectEntity>>> func)
        {
            return table.LeftOuterJoin(func);
        }

        public static ILeftOuterJoin<TSelectEntity> LeftOuterJoin<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<INullableRow<TEntity>, ITuple<IValue<bool>, IJoin<TSelectEntity>>> func)
        {
            return table.LeftOuterJoin(func);
        }

        private static IFrom<TSelectEntity> From<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<IRow<TEntity>, ITuple<IWhere, ISelect<TSelectEntity>>> func)
        {
            return table.From(func);
        }

        private static IFrom<TSelectEntity> From<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<IRow<TEntity>, ISelect<TSelectEntity>> select)
        {
            return table.From(select);
        }

        private static INullableInnerJoin<TSelectEntity> InnerJoin<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<INullableRow<TEntity>, ITuple<IValue<bool>, INullableJoin<TSelectEntity>>> func)
        {
            throw new NotImplementedException();
        }

        private static INullableFrom<TSelectEntity> From<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<INullableRow<TEntity>, INullableJoin<TSelectEntity>> innerJoin)
        {
            throw new NotImplementedException();
        }

        private static IRightOuterJoin<TSelectEntity> RightOuterJoin<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<IRow<TEntity>, ITuple<IValue<bool>, INullableJoin<TSelectEntity>>> func)
        {
            throw new NotImplementedException();
        }

        private static IRightOuterJoin<TSelectEntity> RightOuterJoin<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<IRow<TEntity>, ITuple<IValue<bool>, IWhere, ISelect<TSelectEntity>>> func)
        {
            throw new NotImplementedException();
        }

        private static IRightOuterJoin<TSelectEntity> RightOuterJoin<TEntity, TSelectEntity>(
            ITable<TEntity> table,
            Func<IRow<TEntity>, ITuple<IValue<bool>, IJoin<TSelectEntity>>> func)
        {
            throw new NotImplementedException();
        }
    }
}
